package face.pay.web.statistics;

import face.pay.common.statistics.IuserStatisticsService;
import face.pay.constant.UserType;
import face.pay.entity.UserInfo;
import face.pay.security.annotation.CurrentUser;
import face.pay.util.ResultMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Auther: zkj
 * @Date: 2019/8/6 16:55
 * @Description: 用户登录首页统计
 */
@Controller
@RequestMapping("/user_satistics")
public class UserStatisticsController {

    @Autowired
    private IuserStatisticsService iuserStatisticsService;


    @RequestMapping(value = "/main")
    public String user_main(@CurrentUser UserInfo loginUser){

        String userType =  loginUser.getType();
        if(UserType.ENTERPRISE.equals(userType)){
            return  "main/enterprise_main";
        }else if(UserType.AGENCY.equals(userType)){
            return  "main/agency_main";
        }else if(UserType.OEM.equals(userType)){
            return  "main/oem_main";
        }else if(UserType.ADMIN.equals(userType)){
            return  "main/admin_main";
        }
        return  null;
    }
    /**
     *
     * @param loginUser
     * @return 交易量 分佣 奖励
     */
    @RequestMapping("/tradeAmoumt")
    @ResponseBody
    public ResultMessage enterpriseStatistics(@CurrentUser UserInfo loginUser,@RequestParam Map params){

        return  this.iuserStatisticsService.statistics(loginUser,params);
    }

}
